/****************************************************
    ScriptName:        TapTapModelManger.cs
    Author:            摸鱼程序男
    CreatTime:    2020/12/25 16:45:51
    Description:     Nothing
*****************************************************/

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
using DG.Tweening;
using System.Linq;
using ZYKTool;
using UnityEngine.SceneManagement;
namespace HQL
{
    public class TapTapModelManger : MonoBehaviour
    {
        public void Init()
        {
            TapTapStaticValue.BossAttributes = new Dictionary<BossName, BossAttributes>();
            TapTapStaticValue.PlayerAttributes = new PlayerAttribute(5);

            BossAttributes Boss1 = new BossAttributes(ZYKJsonModelToolBase.Single.ZYKModenGetBoss().Boss1Blood, BossName.Boss1);
            TapTapStaticValue.BossAttributes.Add(Boss1.BossName, Boss1);

           
            TapTapStaticValue.BossAttributes.Add(BossName.Boss2, new BossAttributes(ZYKJsonModelToolBase.Single.ZYKModenGetBoss().Boss2Blood, BossName.Boss2));
            TapTapStaticValue.BossAttributes.Add(BossName.Boss3, new BossAttributes(ZYKJsonModelToolBase.Single.ZYKModenGetBoss().Boss3Blood, BossName.Boss3));
            TapTapStaticValue.BossAttributes.Add(BossName.Boss4, new BossAttributes(ZYKJsonModelToolBase.Single.ZYKModenGetBoss().Boss4Blood, BossName.Boss4));
            TapTapStaticValue.BossAttributes.Add(BossName.Boss5, new BossAttributes(ZYKJsonModelToolBase.Single.ZYKModenGetBoss().Boss5Blood, BossName.Boss5));
            //TapTapStaticValue.BossAttributes.Remove(BossName.Boss2);
        }
     
        private void PlayerDie()
        {
            if (TapTapStaticValue.PlayerAttributes.Blood <= 0)
            {
                Destroy(TapTapStaticValue.Player);
                ZYKTool.Timer.ZYKTimerSystemTool.Instance.ZYKTimerClearAllTaskAndId();
                SceneManager.LoadScene("Start Menu");
                   
            }
        }
        public void Damage(BossName bossName, float blood)
        {
            if (bossName == BossName.None)
            {
               // Debug.LogError(TapTapStaticValue.PlayerAttributes.Blood);
                TapTapStaticValue.PlayerAttributes.Blood -= blood;
                PlayerDie();
            }
            else
            {
                TapTapStaticValue.BossAttributes[bossName].Blood -= blood;

            }
        }
    }

    public class DicTest
    {
        public Dictionary<string, int> my = new Dictionary<string, int>();
        public void Init()
        {
            my.Add("1536589", 1);

            my["454"] = 5;
        }
    }
}